<template>
  <div>
    <!-- <h1>导航条</h1> -->
    <div class="wrap ">
      <div class="l-header">
        <!--    下面包着的是 导航栏分类和搜索框这栏的布局  -->
        <div class="l-navBox">
          <!-- 左边导航栏 -->
          <div class="l-topNav clearfix">
            <div class="l-classify  fl">
              <i class="l-icons"></i>
              <span>分类：</span>
            </div>
            <ul class="l-list clearfix fl">
              <li class="fl" @click="Nav(null,-1)">
                <a :class="{'cur':activeIndex === -1}" >全部</a>
                <!-- <a href="" >全部</a> -->
              </li>
              <li class="fl" v-for="(item , i) in NavList" :value="item.id" :key="item.id" @click="Nav(item.cid,i)">
               
                 <a :class="{'cur':activeIndex === i}"> {{item.c_name}}</a>

              </li>
           
            </ul>
          </div>
          <!-- 右边搜索框区 -->
          <div class="l-searchBox">
            <div class="s-search">
              <input
                type="text"
                placeholder="输入关键词"
                class="s-searchkey"
                id="keyWord"
                v-model="keyword"
              />
              <a   class="s-searchbtn" id="search_btn" @click="searchFtn()"></a>
            </div>
          </div>
        </div>
        <!--    上面包着的是 导航栏分类和搜索框这栏的布局  -->
        <!-- 下面包着的，是写着状态 ，全部 排序 最新上架  查询几个结果项目的这栏 -->
        <div class="l-selectBox">
          <div class="l-select clearfix">
            <div class="condition clearfix fl" style="z-index: 4999;outline:0;">
              <div class="cdt_name fl clearfix">
                <i class="cdt_icon1 fl"></i>
                <span class="fl">状态：</span>
              </div>
              <Select
                 @on-change="Stateftn(listSelected)"
                v-model="listSelected"
                style="width:100px;background:white;border:white;outline:none"
              >
                <Option
                  
                  v-for="item in AllprojectList"
                   
                  :value="item.State"
                  :key="item.s_id"
                  >{{ item.State}}</Option
                >
              </Select>
            </div>
            <div class="goonlineBox">
              <i class="icon"></i>
              <span class="sort">排序：</span>
              <!--------------  最新上线下拉框 -->
              <Select
                 @on-change="getNewGoods(listSelected2)"
                v-model="listSelected2"
                style="width:100px; margin-top:-5px"
              >
                <Option
                  v-for="item in GoonlineBoxtList"
                
                  :value="item.id"
                  :key="item.id"
                  >{{ item.value }}</Option
                >
              </Select>
     
            </div>
            <!-- 查询结果区 -->
            <div class="Pjresults">
              查询结果共<span class="countProject">{{data}}</span>个项目
            </div>
          </div>
        </div>

      </div>
  
        <crowdfunding 
         />
        <guessyoulike />
     
    </div>
  </div>
</template>

<script>
import crowdfunding from "../crowdfunding/Crowdfunding"
import guessyoulike from "../guessyoulike/Guessyoulike"
import { Navselect } from '../../../../../server/allproject.js'
import { StateNav } from '../../../../../server/allproject.js'
// import { Stateftn } from '../../../../../server/allproject.js'

// import cc from './'
export default {
   components: {
    crowdfunding,
    guessyoulike
  },
  data() {
    return {
      data:0,
      keyword:'',
      Navselect:[],//查找分类表数据后装起来
      NavList:[],//把分类表删除后，对的数据后，装起来，这是打印的数组
      StateNav:[],//查找完项目状态表的数据后，装起来
      listSelected:'',
      activeIndex:-1,
      AllprojectList:[],
     
      GoonlineBoxtList: [
        {
          id: "1",
          value: "综合推荐",
        },
        {
          id: "0",
          value: "最新上线",
        },
 
        {
          id: "5",
          value: "停止众筹",
        },
      ],
    };
  },
  created() {

    this.$show.$on('ceshi', this.ceshi);
 
    this.listSelected2 = this.GoonlineBoxtList[0].id;

     Navselect().then(res => {
       this.Navselect = res.data;
       this.Navselect.splice(0,1);
       this.NavList = this.Navselect;
      //  this.Navselect.splice(7,1);
      this.NavList.splice(8,1)

    });
    StateNav().then(res =>{
   

      this.AllprojectList = res.data;
         this.listSelected = this.AllprojectList[0].State;
   
    })
    
  },
  methods: {
    ceshi(e){
      this.data = e;
   

    },
    Nav(id,i){
      this.activeIndex = i
  
  
      this.$show.$emit('sendNavText',id);
    },
    Stateftn(){

       this.$show.$emit('sendNavState',this.listSelected);
 
    },
    searchFtn(){

     this.$show.$emit('sendText',this.keyword);
    },
    getNewGoods(e){

  
      this.$show.$emit('sendgetNewGoods',this.listSelected2);

    }
  },
};
</script>

<style scoped>
/* input:hover{
  background-color: #fff;
  border :white;
} */
body{
  background: #f6f6f6;
}
body,
html {
  min-width: 1200px;
  font-family: "Microsoft Yahei", "\5FAE\8F6F\96C5\9ED1", Arial,
    "Hiragino Sans GB", "\5B8B\4F53";
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}
* {
  margin: 0;
  padding: 0;
  border: 0;
}
li {
  list-style: none;
}
a {
  text-decoration: none;
}
.wrap {
  width: 1200px;
  margin: 30px auto 50px;
  /* border:1px solid rgb(0, 255, 85); */
}
.l-header {
  height: 117px;
  width: 1200px;
  /* background: #fff; */
  margin-bottom: 30px;
  -webkit-box-shadow: 0 0 29px #ececec;
  -moz-box-shadow: 0 0 29px #ececec;
  -ms-box-shadow: 0 0 29px #ececec;
  box-shadow: 0 0 29px #ececec;
}
.l-header .l-navBox {
  overflow: hidden;
  height: 63px;
}
.l-header .l-navBox .l-topNav {
  float: left;
  padding-left: 20px;
  padding-top: 20px;
  font-size: 14px;
  color: #323232;
  line-height: 14px;
}
.clearfix {
  display: inline-table;
  display: block;
  zoom: 1;
}
.l-header .l-navBox .l-topNav .l-classify {
  margin-right: 12px;
  height: 24px;
  line-height: 24px;
}
/* 分类字左边的小图标 */
.l-header .l-navBox .l-topNav .l-classify .l-icons {
  display: inline-block;
  margin-right: 6px;
  width: 14px;
  height: 14px;
  background-position: 0 -6px;
  vertical-align: middle;
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/licons-se60b58b04b.png);
  background-repeat: no-repeat;
}
i {
  font-style: normal;
}
.l-header .l-navBox .l-topNav .l-classify span {
  vertical-align: middle;
}
.fl {
  float: left;
}
.clearfix:after {
  display: block;
  content: "";
  clear: both;
  visibility: hidden;
}
.l-header .l-navBox .l-topNav .l-list li a.cur {
  background-position: 0 0;
  color: #fff;
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/cur-s4effb5dc05.png);
}
li a:hover {
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/cur-s4effb5dc05.png);
  background-repeat: no-repeat;
  color: #fff;
}
.l-header .l-navBox .l-topNav .l-list li a {
  display: block;
  transition: all 0.2s ease-in-out, opacity 1s;
}
a:hover,
a:link,
a:visited {
  text-decoration: none;
}
a {
  cursor: pointer;
  outline: 0;
}
.l-header .l-navBox .l-topNav .l-list li {
  width: 52px;
  height: 24px;
  line-height: 24px;
  margin-right: 5px;
  text-align: center;
}
.l-header .l-navBox .l-topNav {
  float: left;
  padding-left: 20px;
  padding-top: 20px;
  font-size: 14px;
  color: #323232;
  line-height: 14px;
}
.l-header .l-navBox .l-topNav .l-list li a.cur {
  background-position: 0 0;
  color: #fff;
}
/* 右边搜索框区 */
.l-header .l-navBox .l-searchBox {
  float: right;
  padding-top: 15px;
  padding-right: 19px;
}
.l-header .l-navBox .l-searchBox .s-search {
  width: 230px;
  height: 32px;
  background-position: 0 -32px;
  line-height: 32px;
  position: relative;
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/licons-se60b58b04b.png);
  background-repeat: no-repeat;
}
.l-header .l-navBox .l-searchBox .s-search .s-searchkey {
  position: absolute;
  top: 2px;
  height: 28px;
  line-height: 28px;
  background: #fff;
  left: 14px;
  font-family: "Microsoft Yahei";
  width: 150px;
  font-size: 12px;
}
input {
  font-size: 12px;
  vertical-align: middle;
  color: #333;
  outline: 0;
}
/* 输入框那个放大镜的图标 */
.l-header .l-navBox .l-searchBox .s-search .s-searchbtn {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 12px;
  height: 12px;
  background-position: 0 -20px;
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/licons-se60b58b04b.png);
  background-repeat: no-repeat;
}
.l-header .l-selectBox {
  height: 46px;
  background: #fafafa;
  padding-left: 20px;
  padding-top: 8px;
  padding-right: 20px;
  width: 1160px;
}
.l-header .l-selectBox .condition {
  margin-right: 15px;
}
.l-header .l-selectBox .condition .cdt_name {
  line-height: 36px;
}
.l-header .l-selectBox .condition .cdt_name .cdt_icon1 {
  width: 14px;
  height: 14px;
  background-position: 0 -77px;
  vertical-align: middle;
  margin-top: 11px;
  margin-right: 6px;
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/licons-se60b58b04b.png);
  background-repeat: no-repeat;
}
.l-header .l-selectBox .condition .cdt_name span {
  vertical-align: middle;
  font-size: 14px;
  color: #323232;
}
.l-header .l-selectBox .condition .cu-select-s {
  width: 128px;
  height: 36px;
  font-size: 14px;
  line-height: 36px;
}
.cu-select {
  margin-right: 10px;
  float: left;
  position: relative;
  text-align: left;
}
.l-header .l-selectBox .condition .cu-select .title {
  height: 100%;
  display: block;
  padding: 0 10px;
  cursor: pointer;
  border: 0;
}
.l-header .l-selectBox .condition .cu-select-s {
  width: 128px;
  height: 36px;
  font-size: 14px;
  line-height: 36px;
}
.cu-select-s {
  height: 24px;
}
.l-header .l-selectBox .condition .cu-select .title em {
  font-style: normal;
  position: relative;
}
.l-header .l-selectBox .condition .cu-select .title {
  height: 100%;
  display: block;
  padding: 0 10px;
  cursor: pointer;
  border: 0;
}
.l-header .l-selectBox .condition .cu-select .title em strong {
  position: absolute;
  width: 10px;
  height: 6px;
  background-position: 0 0;
  top: 6px;
  right: -18px;
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/licons-se60b58b04b.png);
  background-repeat: no-repeat;
}

.l-header .l-selectBox .condition .cu-select s {
  display: none;
}
.cu-select s {
  height: 0;
  width: 0;
  margin-top: -3px;
  position: absolute;
  top: 50%;
  right: 10px;
  z-index: 1;
  border-width: 5px;
  border-style: solid;
  border-color: #323232 transparent transparent;
  cursor: pointer;
  transition: all 0.3s;
}
.cu-select s i {
  width: 0;
  height: 0;
  position: absolute;
  top: -7px;
  left: -5px;
  z-index: 1;
  border-width: 5px;
  border-color: #fff transparent transparent;
  border-style: solid;
}
.l-header .l-selectBox .condition .cu-select-s ul {
  top: 36px;
}
.goonlineBox {
  width: 150px;
  height: 43px;
  /* border:1px solid blue; */
  /* background-color: red; */
  margin-left: 200px;
}
.icon {
  width: 50px;
  height: 13px;
  display: inline-block;
  background-position: 0 -64px;
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/licons-se60b58b04b.png);
  background-repeat: no-repeat;
  margin-top: 11px;
}
.sort {
  margin-left: -30px;
  margin-top: 10px;
  position: absolute;
}
.Pjresults {
  width: 221px;
  height: 34px;
  position: absolute;
  margin-left: 942px;
  margin-top: -38px;
  text-align: center;
  line-height: 34px;
}
.countProject {
  font-family: Arial;
  font-size: 14px;
  color: #323232;
  font-weight: bold;
}

</style>
